package com.aidex.system.service.impl;

import java.util.List;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.domain.entity.SysUser;
import com.aidex.common.core.domain.entity.SysDept;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.framework.cache.DeptUtils;
import com.aidex.framework.cache.UserUtils;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.aidex.system.mapper.OptimizationSuggestionRuleMapper;
import com.aidex.system.domain.OptimizationSuggestionRule;
import com.aidex.system.service.OptimizationSuggestionRuleService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 优化建议规则设置Service业务层处理
 * @author jmy
 * @email jmyinjg@163.com
 * @date 2021-10-09
 */
@Service
@Transactional(readOnly = true)
public class OptimizationSuggestionRuleServiceImpl extends BaseServiceImpl<OptimizationSuggestionRuleMapper, OptimizationSuggestionRule> implements OptimizationSuggestionRuleService
{
    private static final Logger log = LoggerFactory.getLogger(OptimizationSuggestionRuleServiceImpl.class);

    /**
     * 获取单条数据
     * @param optimizationSuggestionRule 优化建议规则设置
     * @return 优化建议规则设置
     */
    @Override
    public OptimizationSuggestionRule get(OptimizationSuggestionRule optimizationSuggestionRule)
    {
        OptimizationSuggestionRule dto = super.get(optimizationSuggestionRule);
        return dto;
    }

    /**
     * 获取单条数据
     * @param id 优化建议规则设置id
     * @return 优化建议规则设置
     */
    @Override
    public OptimizationSuggestionRule get(String id)
    {
        OptimizationSuggestionRule dto = super.get(id);
        return dto;
    }


    /**
     * 查询优化建议规则设置列表
     * @param optimizationSuggestionRule 优化建议规则设置
     * @return 优化建议规则设置
     */
    @Override
    public List<OptimizationSuggestionRule> findList(OptimizationSuggestionRule optimizationSuggestionRule)
    {
        return super.findList(optimizationSuggestionRule);
    }

    /**
     * 分页查询优化建议规则设置列表
     * @param optimizationSuggestionRule 优化建议规则设置
     * @return 优化建议规则设置
     */
    @Override
    public PageInfo<OptimizationSuggestionRule> findPage(OptimizationSuggestionRule optimizationSuggestionRule)
    {
        return super.findPage(optimizationSuggestionRule);
    }

    /**
     * 保存优化建议规则设置
     * @param optimizationSuggestionRule
     * @return 结果
     */
    @Override
    public boolean save(OptimizationSuggestionRule optimizationSuggestionRule)
    {
        return super.save(optimizationSuggestionRule);
    }


    /**
     * 删除优化建议规则设置信息
     * @param optimizationSuggestionRule
     * @return 结果
     */
    @Override
    public boolean remove(OptimizationSuggestionRule optimizationSuggestionRule)
    {
        return super.remove(optimizationSuggestionRule);
    }

    /**
     * 批量删除优化建议规则设置
     * @param ids 需要删除的优化建议规则设置ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteOptimizationSuggestionRuleByIds(String[] ids)
    {
        return mapper.deleteOptimizationSuggestionRuleByIds(ids);
    }

    @Override
    public OptimizationSuggestionRule getRule() {
        List<OptimizationSuggestionRule> list = mapper.findList(new OptimizationSuggestionRule());
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }

}
